import { iplocaltion } from "@/services"
import { useRequest } from "ahooks"
import { Spin, Typography } from "antd"
import React, { useEffect } from "react"

export default ({ ip }: any) => {
  const { data, runAsync, loading } = useRequest(iplocaltion, {
    manual: true,
  })
  useEffect(() => {
    runAsync({ ip })
  }, [])
  return (
    <Spin spinning={loading}>
      {
        <Typography.Paragraph>
          <pre>{JSON.stringify(data?.data?.result, undefined, 2)}</pre>
        </Typography.Paragraph>
      }
    </Spin>
  )
}
